(define (list-index pred lst)
    (list-index-aux pred lst 0)
)

(define (list-index-aux pred lst n)
    (cond 
        ((null? lst) #f)
        ((pred (car lst)) n)
        (else 
            (list-index-aux pred (cdr lst) (+ 1 n))
        )
    )
)

(display 
    (list-index number? `(a 2 (1 3) b 7))
)

(display 
    (list-index symbol? `(a (b c) 17 foo))
)

(display 
    (list-index symbol? `(1 2 (a b) 3))
)
